﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GMS.Client.Core
{
    /// <summary>
    /// 控件类
    /// </summary>
    public class CustomControl
    {
        public CustomControl(IntPtr parentHandle, string className, string titleName, CustomControlNameType customControlNameType = CustomControlNameType.Default)
        {
            this.Handle = Win32API.GetChildWindowHandle(parentHandle, ClassName, TitleName, Timeout);
            this.ParentHandle = Win32API.GetParent(this.Handle);
            this.CustomControlNameType = customControlNameType;
        }

        public CustomControl(IntPtr handle, CustomControlNameType customControlNameType = CustomControlNameType.Default)
        {
            this.Handle = handle;
            this.ParentHandle = Win32API.GetParent(this.Handle);
            this.CustomControlNameType = customControlNameType;
        }

        protected int Timeout = 10;

        /// <summary>
        /// 句柄
        /// </summary>
        public IntPtr Handle { get; set; }

        /// <summary>
        /// 父句柄
        /// </summary>
        public IntPtr ParentHandle { get; set; }

        /// <summary>
        /// 类名
        /// </summary>
        public string ClassName { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string TitleName { get; set; }

        /// <summary>
        /// 控件名称
        /// </summary>
        public CustomControlNameType CustomControlNameType { get; set; }
    }
}
